// 'username=lindaidai; user-id=12345; user-roles=home, me, setting'

// let document = {cookie:'username=lindaidai; user-id=12345; user-roles=home, me, setting'}

function getCookie(name) {
  // if(name == undefined | name == "") throw new Error("name is required")
  let document = {
    cookie: "username=lindaidai; user-id=12345; user-roles=home, me, setting",
  };

  var match = document.cookie.match(
    new RegExp("(" + name + ")" + `=([^;'"]*)`)
  );
  // console.log(match)
}

getCookie();
getCookie("user");
getCookie("username");
getCookie("user-id");
getCookie("user-roles");
